<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>点击切换</button>
    <h2>Hello Word</h2>
</body>
<script>
    var btn = document.querySelector('button');
    var h2 = document.querySelector('h2');
    btn.onclick = function () {
        h2.style.color = 'red';
        h2.innerHTML = '你好 Word'
    }
</script>

</html>